package com.lu.pojo.generic;

/**
 * @author luzhenfang
 * @date 2020 07 07
 * @description 泛型 设计
 *  - 更安全
 *  - 更便捷
 *  - 更健壮
 */
// 泛型类

public class GenericContainer<T,U> {
    // 错误的写法 泛型不能操作静态上下文
    // private static T stest;
    private T first;
    private U second;

    public T getFirst() {
        return first;
    }

    public void setFirst(T first) {
        this.first = first;
    }

    public U getSecond() {
        return second;
    }

    public void setSecond(U second) {
        this.second = second;
    }


    // 泛型方法
    public <E> void printTest(E str){
        System.out.println("str = " + str);
    }
    public static <E> void printArr(E ...e){
        for (E i : e) {
            System.out.println("i = " + i); 
        }
    }
}
